package cn.getech.data.development.utils.ranger;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;

/**
 *  @company: getech[tcl]
 *  @author: hujz
 *  @Date: 2019/12/28 16:14
 *  @Description: 获取请求的客户端,去请求数据
 */
public class RangerRestUtil {

    private volatile static Client client;

    private RangerRestUtil(){
    }

    public static Client getInstanceRangerClient(String userName,String password) {
        if(null == client){
            synchronized (RangerRestUtil.class){
                if(null == client){
                    client = Client.create();
                    client.addFilter(new HTTPBasicAuthFilter(userName, password));
                }
            }
        }
        return client;
    }
}
